<template>
	<view>
		<view class="userModel u-flex u-row-center u-col-center" @click="mask">
			<view class="cont u-flex-col u-col-center" style="width: 300px" @click.stop="" :style="{background: vk.getVuex('$app.config.bg.model'), color: vk.getVuex('$app.config.color.model')}">
				<image :src="vk.getVuex('$setting.base.logo')" style="border-radius: 128rpx;"></image>
				
				<view class="text u-p-l-50 u-p-r-50 u-text-center" v-html="title"></view>
				
				<!-- <view v-if="vk.getVuex('$setting.client.banner_id') && !download" class="u-p-t-30" style="width: 300px;height: 115px;">
					<ad :unit-id="vk.getVuex('$setting.client.banner_id')" type="banner" ad-theme="black"></ad>
				</view> -->
				<view class="u-flex-col u-col-center u-text-center" style="width: 100%;" v-if="!download">
					<view class="btn u-flex u-row-center u-col-center" :class="ad?'adClass':''" hover-class="hover-class" hover-stay-time="10" @click.stop="save" :style="{backgroundImage: vk.getVuex('$app.config.bg.button'), color: vk.getVuex('$app.config.color.button')}">
						<image v-if="btnText === '超清视频下载'" src="/static/icon/video.png" style="width: 40rpx;height: 40rpx;margin-top: 0;margin-bottom: 0;margin-right: 10rpx;"></image>
						<view class="">{{btnText}}</view>
						<button v-if="ad" open-type="share" style="position: absolute;top: 0;;width: 100%;height: 100%;opacity: 0;"></button>
					</view>
					<view v-if="closeText!=' '" class="no u-text-center u-p-t-30" @click.stop="close" :style="{color: vk.getVuex('$app.config.color.tips')}">{{closeText}}</view>
				</view>
				<view class="" v-else style="width: calc(100% - 100rpx);">
					<view class="u-p-t-40">
						<u-divider half-width="100%" :border-color="vk.getVuex('$app.config.color.light')" :color="vk.getVuex('$app.config.color.light')" bg-color="rgba(0,0,0,0)">下载方式</u-divider>
					</view>
					<view class="u-p-t-40 u-p-b-25">
						<view class="u-flex u-row-between u-col-center">
							<view class="">
								<view class="u-font-16">超清无水印原图</view>
								<view class="u-font-13 u-p-t-10" :style="{color: vk.getVuex('$app.config.color.tips')}">看完广告后，自动下载</view>
							</view>
							<view class="u-flex u-row-center u-col-center ad" @click.stop="save" :style="{backgroundImage: vk.getVuex('$app.config.bg.button'), color: vk.getVuex('$app.config.color.button')}">
								<u-icon name="play-circle" size="26"></u-icon>
								<view class="u-p-l-5 u-font-13">{{btnText}}</view>
							</view>
						</view>
						<!-- <view class="u-font-13 u-p-t-10" :style="{color: vk.getVuex('$app.config.color.sec')}">看5次广告，额外赠5次免广告超清下载</view> -->
					</view>
					<view class="u-flex u-row-between u-col-center u-p-t-30 u-p-b-30">
						<view class="">
							<view class="u-font-16">普通画质下载</view>
							<view class="u-font-13 u-p-t-10" :style="{color: vk.getVuex('$app.config.color.tips')}">普通画质，免广告下载</view>
						</view>
						<view class="u-flex u-row-center u-col-center ad" @click.stop="plain" :style="{backgroundImage: vk.getVuex('$app.config.bg.button_dis'), color: vk.getVuex('$app.config.color.button_dis')}">
							<u-icon name="download" size="26"></u-icon>
							<view class="u-p-l-5 u-font-13">普通下载</view>
						</view>
					</view>
				</view>
				
				<view class="" style="position: absolute;top: 20rpx; right: 30rpx;" @click.stop="mask">
					<u-icon name="close" color="#666666" size="36"></u-icon>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'model',
		props:{
			title:{	//显示的内容
				type: String,
				default: '为了更好的浏览体验，需要点击下方授权登录！'
			},
			authorize:{	//是否授权登录
				type: Boolean,
				default: false
			},
			ad:{	//广告
				type: Boolean,
				default: false
			},
			btnText:{	//按钮文字
				type: String,
				default: '授权登录'
			},
			closeText:{	//关闭文字
				type: String,
				default: '暂时不用'
			},
			download:{
				type: Boolean,
				default: false
			}
		},
		data() {
			return {
				
			};
		},
		methods: {
			save(){
				if(this.authorize){
					this.$parent.getUserInfo()
				}else{
					this.$emit('save');
				}
			},
			close(){
				this.$emit('close');
			},
			plain(){
				this.$emit('plain');
			},
			mask(){
				this.$emit('mask');
			},
		}
	}
</script>

<style lang="scss" scoped>
	.userModel{
		z-index: 9999999;
		position: fixed;
		top: 0;
		left: 0;
		width: 100vw;
		height: 100vh;
		background-color: rgba(0,0,0,0.6);
		// backdrop-filter: blur(4rpx);
		.cont{
			position: relative;
			margin-bottom: 100rpx;
			padding: 0 0 50rpx 0;
			border-radius: 32rpx;
			image{
				width: 128rpx;
				height: 128rpx;
				margin-top: -60rpx;
				margin-bottom: 30rpx;
			}
			.text{
				line-height: 56rpx;
			}
			.btn{
				position: relative;
				margin-top: 40rpx;
				color: #562000;
				font-weight: 500;
				width: 60%;
				line-height: 80rpx;
				border-radius: 80rpx;
				background-image: linear-gradient(to bottom right, #fce03d , #f8c93c);
			}
			.no{
				color: #B8B8B8;
			}
		}
	}
	.num{
		font-size: 16px;
		font-weight: 700;
		padding: 0 8rpx;
	}
	
	.adClass{
		animation: tiaobig 1.2s ease-in-out alternate infinite;
		// animation-iteration-count:1;
	}
	@keyframes tiaobig {
		25% {
			transform: scale(0.98);
		}
		50% {
			transform: scale(1.08);
		}
		75% {
			transform: scale(0.98);
		}
		100% {
			transform: scale(1.08);
		}
	}
	.hover-class{
		transform:scale(0.95);
		transition: all 0.2s;
	}
	
	.ad{
		padding: 12rpx 30rpx;
		border-radius: 8rpx;
	}
</style>
